import sys
import pandas as pd


def load_scapycsv(filename):
    data = pd.read_csv(filename)
    return data

if __name__ == '__main__':
    file_a = sys.argv[1]
    file_b = sys.argv[2]
    data_a = load_scapycsv(file_a)
    data_b = load_scapycsv(file_b)

    print('wireless loss rate:', (len(data_a) - len(data_b)) / len(data_a))

    b_seq_list = data_b['seq'].to_list()

    with open(f'wireless.pps', 'w') as f:
        for index, row in data_a.iterrows():
            seq_a = row['seq']
            t_ms = row['t_ms']
            if seq_a not in b_seq_list:
                f.write(f'-{t_ms}\n')
            else:
                f.write(f'{t_ms}\n')
